package com.chencs.biz.member.service;

import com.chencs.biz.member.mapper.MemberMapper;
import com.chencs.vo.biz.member.MemberModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by fangzehua on 2017/7/4.
 */
@Service
@Transactional
public class MemberService {

    @Autowired
    private MemberMapper memberMapper;


   public   List<MemberModel> getMemberList(){
        return  memberMapper.getMemberList();
    }


    public void insertMember(MemberModel memberModel){
       MemberModel m = memberMapper.findMemberBySid(memberModel.getTaobaosid());
       if(m==null){
           memberMapper.insertMember(memberModel);
       }
    }

    public  void  updateMember(MemberModel memberModel){
        memberMapper.updateMember(memberModel);
    }

    public  MemberModel findMemberById(String id){
        return  memberMapper.findMemberById(id);
    }

    public  MemberModel findMemberBySid(String sid){
        return  memberMapper.findMemberBySid(sid);
    }
}
